/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "ASISTENCIA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Asistencia.findAll", query = "SELECT a FROM Asistencia a"),
    @NamedQuery(name = "Asistencia.findByUniCod", query = "SELECT a FROM Asistencia a WHERE a.asistenciaPK.uniCod = :uniCod"),
    @NamedQuery(name = "Asistencia.findByPerCod", query = "SELECT a FROM Asistencia a WHERE a.asistenciaPK.perCod = :perCod"),
    @NamedQuery(name = "Asistencia.findByPerUniCod", query = "SELECT a FROM Asistencia a WHERE a.asistenciaPK.perUniCod = :perUniCod"),
    @NamedQuery(name = "Asistencia.findByAsiFech", query = "SELECT a FROM Asistencia a WHERE a.asistenciaPK.asiFech = :asiFech"),
    @NamedQuery(name = "Asistencia.findByAsiIni", query = "SELECT a FROM Asistencia a WHERE a.asistenciaPK.asiIni = :asiIni"),
    @NamedQuery(name = "Asistencia.findByAsiFin", query = "SELECT a FROM Asistencia a WHERE a.asiFin = :asiFin"),
    @NamedQuery(name = "Asistencia.findByAsiIng", query = "SELECT a FROM Asistencia a WHERE a.asiIng = :asiIng"),
    @NamedQuery(name = "Asistencia.findByAsiRefSal", query = "SELECT a FROM Asistencia a WHERE a.asiRefSal = :asiRefSal"),
    @NamedQuery(name = "Asistencia.findByAsiRefRet", query = "SELECT a FROM Asistencia a WHERE a.asiRefRet = :asiRefRet"),
    @NamedQuery(name = "Asistencia.findByAsiSal", query = "SELECT a FROM Asistencia a WHERE a.asiSal = :asiSal"),
    @NamedQuery(name = "Asistencia.findByAsiEst", query = "SELECT a FROM Asistencia a WHERE a.asiEst = :asiEst"),
    @NamedQuery(name = "Asistencia.findByAsiTipo", query = "SELECT a FROM Asistencia a WHERE a.asiTipo = :asiTipo"),
    @NamedQuery(name = "Asistencia.findByAsiTurnos", query = "SELECT a FROM Asistencia a WHERE a.asiTurnos = :asiTurnos")})
public class Asistencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AsistenciaPK asistenciaPK;
    @Column(name = "ASI_FIN")
    @Temporal(TemporalType.TIME)
    private Date asiFin;
    @Column(name = "ASI_ING")
    @Temporal(TemporalType.TIME)
    private Date asiIng;
    @Column(name = "ASI_REF_SAL")
    @Temporal(TemporalType.TIME)
    private Date asiRefSal;
    @Column(name = "ASI_REF_RET")
    @Temporal(TemporalType.TIME)
    private Date asiRefRet;
    @Column(name = "ASI_SAL")
    @Temporal(TemporalType.TIME)
    private Date asiSal;
    @Column(name = "ASI_EST")
    private Short asiEst;
    @Column(name = "ASI_TIPO")
    private Short asiTipo;
    @Column(name = "ASI_TURNOS")
    private Short asiTurnos;
    @JoinColumns({
        @JoinColumn(name = "UNI_COD", referencedColumnName = "UNI_COD", insertable = false, updatable = false),
        @JoinColumn(name = "PER_COD", referencedColumnName = "PER_COD", insertable = false, updatable = false),
        @JoinColumn(name = "PER_UNI_COD", referencedColumnName = "PER_UNI_COD", insertable = false, updatable = false)})
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private PersonalUnidad personalUnidad;

    public Asistencia() {
    }

    public Asistencia(AsistenciaPK asistenciaPK) {
        this.asistenciaPK = asistenciaPK;
    }

    public Asistencia(short uniCod, int perCod, int perUniCod, Date asiFech, Date asiIni) {
        this.asistenciaPK = new AsistenciaPK(uniCod, perCod, perUniCod, asiFech, asiIni);
    }

    public AsistenciaPK getAsistenciaPK() {
        return asistenciaPK;
    }

    public void setAsistenciaPK(AsistenciaPK asistenciaPK) {
        this.asistenciaPK = asistenciaPK;
    }

    public Date getAsiFin() {
        return asiFin;
    }

    public void setAsiFin(Date asiFin) {
        this.asiFin = asiFin;
    }

    public Date getAsiIng() {
        return asiIng;
    }

    public void setAsiIng(Date asiIng) {
        this.asiIng = asiIng;
    }

    public Date getAsiRefSal() {
        return asiRefSal;
    }

    public void setAsiRefSal(Date asiRefSal) {
        this.asiRefSal = asiRefSal;
    }

    public Date getAsiRefRet() {
        return asiRefRet;
    }

    public void setAsiRefRet(Date asiRefRet) {
        this.asiRefRet = asiRefRet;
    }

    public Date getAsiSal() {
        return asiSal;
    }

    public void setAsiSal(Date asiSal) {
        this.asiSal = asiSal;
    }

    public Short getAsiEst() {
        return asiEst;
    }

    public void setAsiEst(Short asiEst) {
        this.asiEst = asiEst;
    }

    public Short getAsiTipo() {
        return asiTipo;
    }

    public void setAsiTipo(Short asiTipo) {
        this.asiTipo = asiTipo;
    }

    public Short getAsiTurnos() {
        return asiTurnos;
    }

    public void setAsiTurnos(Short asiTurnos) {
        this.asiTurnos = asiTurnos;
    }

    public PersonalUnidad getPersonalUnidad() {
        return personalUnidad;
    }

    public void setPersonalUnidad(PersonalUnidad personalUnidad) {
        this.personalUnidad = personalUnidad;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (asistenciaPK != null ? asistenciaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Asistencia)) {
            return false;
        }
        Asistencia other = (Asistencia) object;
        if ((this.asistenciaPK == null && other.asistenciaPK != null) || (this.asistenciaPK != null && !this.asistenciaPK.equals(other.asistenciaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.Asistencia[ asistenciaPK=" + asistenciaPK + " ]";
    }
    
}
